#!usr/bin/env python 
# -*- coding: utf-8 -*-
import datetime
import os

from config import setting

__author__ = '锄禾'

class Plan:
    def __init__(self):
        self.coverageLevel = setting.CoverageLevel
        self.runCaseTime = datetime.datetime.now()
        self.logPath = self.create_this_time_foler()
        self.deviceList = []
        self.deviceNum = str(len(self.deviceList))
        self.passedDevice = 0
        self.failedDevice = 0
        self.endTime = None
        self.resultHtml = '<a>测试结果</a>'

    def create_this_time_foler(self):
        path = os.getcwd() + '/result/' + self.runCaseTime.strftime('%Y%m%d%H%M%S')
        if not os.path.exists(path):
        #if not os._exists(path):
            os.makedirs(path)
        return path

    def get_device_list(self, app):
        device_list = []
        string = ''
        outLine = os.popen('adb devices').readlines()
        for line in outLine:
            if string in line:
                device_id = line[0:line.index(string)]
                device = Device